<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>居民区项目信息</title>
<link href="/djzx/css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/djzx/js/jquery-1.8.1.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/djzx/js/backPage/clientSideApp.js"></script>
<script type="text/javascript">
function toEditProject(timeKey){
	window.location.href="/djzx/CommunityProjectAction!toEditProject.action?communityProject.timeKey=" + timeKey + "&editFrom=2";;
}

window.onload = function(){
	var flag = $('#flag').val();
	if(flag != ""){
		alert(flag);
	}
	$('#flag').val('');
};

function delProjectActivity(timeKey){
	var r = confirm("确定要删除吗?");
	if(r){
		$.post(
				"/djzx/CommunityProjectAction!delProjectActivity.action",
				{
					"communityProjectActivity.timeKey":timeKey
				},
				function(data){
					alert(data.message);
					if(data.success){
						var projectTimeKey =  $('#timeKey').val();
						window.location.href="/djzx/CommunityProjectAction!toShowProject.action?communityProject.timeKey=" + projectTimeKey;
					}
				},
				"json"
				)
	}
}

function toAddProjectActivity(){
	var projectTimeKey =  $('#timeKey').val();
	window.location.href="/djzx/CommunityProjectAction!toAddProjectActivity.action?communityProject.timeKey=" + projectTimeKey;
}

function toEditProjectActivity(timeKey){
	var projectTimeKey =  $('#timeKey').val();
	window.location.href="/djzx/CommunityProjectAction!toEditProjectActivity.action?communityProjectActivity.timeKey=" 
						+ timeKey + "&editFrom=1" + "&communityProject.timeKey=" + projectTimeKey;
}

function searchProjectActivity(){
	ajaxProjectActivity(1);
}

function firstPage(){
	ajaxProjectActivity(1);
}

function prevPage(){
	var start =parseInt($("#start").html());
	if(start <= 1){
		start = 1;
	}else{
		start--;
	}
	ajaxProjectActivity(start);
}

function nextPage(){
	var start =parseInt($("#start").html());
	var count = parseInt($("#pageCount").html());
	if(start >= count){
		start = count;
	}else{
		start++;
	}
	ajaxProjectActivity(start);
}

function endPage(){
	var last = parseInt($("#pageCount").html());
	ajaxProjectActivity(last);
}

function ajaxProjectActivity(start){
	var param = $.trim($('#param').val());
	var paramValue = $.trim($('#paramValue').val());
	var name = "";
	var projectTimeKey =  $('#timeKey').val();
	
	if(param == 'name'){
		name = paramValue;
	}
	
	$.ajax({
		url:'${pageContext.request.contextPath}/CommunityProjectAction!searchProjectActivityList.action',
		data:{
			"page.currPage":start,
			"communityProjectActivity.name":name,
			"communityProject.timeKey":projectTimeKey
		},
		type:'post',
		dataType:'json',
		success:function(data){
			var str="";
			if(data.map.length>0){
				$.each(data.map,function(i){
					str+='<tr><td class="td_01">'+data.map[i].index+
					'</td><td class="td_01"><a href="/djzx/CommunityProjectAction!toShowProjectActivity.action?communityProjectActivity.timeKey='+data.map[i].timeKey+'" target="_blank">'+data.map[i].name+'</a>'+
					'</td><td class="td_01">'+data.map[i].project+
					'</td><td nowrap class="td_01"><a href="/djzx/CommunityProjectAction!toShowProjectActivity.action?communityProjectActivity.timeKey='+data.map[i].timeKey+'" target="_blank">查看</a>|<a href="javascript:void(0)" onclick="toEditProjectActivity('+data.map[i].timeKey+')">编辑</a>|<a href="javascript:void(0)" onclick="delProjectActivity('+data.map[i].timeKey+')">删除</a></td></tr>';
				});
			}
			$("#nodeContent").html(str);
			$("#start").html(data.object.currPage);
			$("#pageCount").html(data.object.pageCount);
			$("#count").html(data.object.count);
		}
	}); 
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" align="center" valign="bottom" class="td06"><table width="98%" border="0" cellspacing="3" cellpadding="0">
      <tr>
        <td width="15"><img src="/djzx/images/index_32.gif" width="9" height="9"></td>
        <td valign="bottom" class="title">项目显示</td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<input type="hidden" name="timeKey" id="timeKey" value="${communityProject.timeKey }" />
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="120" height="24" class="td_form01">项目名称</td>
        <td nowrap class=td_form02>
        	${communityProject.name }
        </td>
        <td width="120" class="td_form01">项目内容</td>
        <td nowrap class=td_form02>
        	${communityProject.content }
        </td>
      </tr>
      <tr>
        <td class="td_form01">参加人数</td>
        <td nowrap class=td_form02>
        	${communityProject.attendNum }
        </td>
        <td class="td_form01">党组织名称</td>
        <td nowrap class=td_form02>
        	${communityProject.communityGeneralParty.name }
        </td>
      </tr>
      <tr>
        <td class="td_form01">在职党员人数</td>
        <td nowrap class=td_form02>
        	${communityProject.workMemberNum }
        </td>
        <td class="td_form01">日期</td>
        <td nowrap class=td_form02>
        	${communityProject.date }
        </td>
      </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
	    <input name="Submit2" type="button" class="buttonface" value="  编辑  " onClick="toEditProject(${communityProject.timeKey })">
    </td>
  </tr>
</table>
<br>
<input id="flag" value="${flag }" type="hidden"/>
<input id="timeKey" value="${communityProject.timeKey }" type="hidden"/>
<table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="td_page">
	  查询参数：
      <select name="param" id="param">
        <option value="name">活动名称</option>
      </select>
             参数值：
      <input name="paramValue" id="paramValue" type="text" class="input" size="10">
      <input type="button" class="buttonface02" value=" 查询 " onclick="searchProjectActivity()">
	  <input type="button" class="buttonface02" value=" 新增 " onclick="toAddProjectActivity()">
    </td>
  </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td nowrap class="td_top">序号</td>
    <td nowrap class="td_top">活动名称</td>
    <td nowrap class="td_top">所属项目</td>
	 <td nowrap class="td_top">操作</td>
  </tr>
  <tbody id="nodeContent">
  <s:iterator value="communityProjectActivityList" var="c" status="statu">
  <tr> 
    <td class="td_01">${statu.index+1 }</td>
    <td class="td_01">
    <a href="/djzx/CommunityProjectActivityAction!toShowProjectActivity.action?communityProjectActivity.timeKey=${c.timeKey}" target="_blank">${c.name }</a>
    </td>
    <td class="td_01">${c.communityProject.name }</td>
	<td nowrap class="td_01">
		<a href="/djzx/CommunityProjectActivityAction!toShowProjectActivity.action?communityProjectActivity.timeKey=${c.timeKey}" target="_blank">查看</a>|
		<a href="#" onclick="toEditProjectActivity(${c.timeKey})">编辑</a>|
		<a href="#" onclick="delProjectActivity(${c.timeKey })">删除</a>
	</td>
  </tr>
  </s:iterator>
  </tbody>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td nowrap width="95%" class="td_top"></td>
  </tr>
</table>
<table width="95%"  border="0" cellpadding="0" cellspacing="0" class="table02" align="center">
  <tr>
    <td height="30" align="right">
	    <img src="/djzx/images/1.gif" width="4" height="5" align="absmiddle"> <a href="javascipt:;" onclick="firstPage()">首页</a>　
	    <img src="/djzx/images/2.gif" width="3" height="5" align="absmiddle"> <a href="javascipt:;" onclick="prevPage()">上一页</a>　 
	    <img src="/djzx/images/2-2.gif" width="3" height="5" align="absmiddle"> <a href="javascipt:;" onclick="nextPage()">下一页</a>　 
	    <img src="/djzx/images/3.gif" width="4" height="5" align="absmiddle"> <a href="javascipt:;" onclick="endPage()">末页</a>　　
	         当前第<span id="start">${page.currPage}</span>页,共<span id="pageCount">${page.pageCount}</span>页,共<span id="count">${page.count}</span>条记录
    </td>
  </tr>
</table>
</body>
</html>